﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    mc:Ignorable="d">
	<!-- Resource dictionary entries should be defined here. -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Colors.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <Style TargetType="{x:Type Button}">
        <Setter Property="Foreground">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource Application_Control_Foreground}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="MinWidth" Value="75"/>
        <Setter Property="MinHeight" Value="22"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=ButtonTemplate, TypeInTargetAssembly={x:Type Button}}}"/>
	</Style>
	
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=ButtonTemplate, TypeInTargetAssembly={x:Type Button}}" TargetType="{x:Type Button}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_BorderBrush}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Background}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="MouseOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_BorderBrush}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_Background}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_Foreground_Pressed}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="PressedIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_BorderBrush_Pressed}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_Background_Pressed}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_Foreground_Pressed}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="PressedOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_BorderBrush_Pressed}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBorder">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Background_Pressed}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Control_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Control_Foreground_Pressed}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>

        <Grid x:Name="MainGrid" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
            <Border x:Name="ButtonBorder" BorderThickness="1" CornerRadius="2" Height="Auto" Width="Auto" Margin="0">
            	<Border.BorderBrush>
            		<SolidColorBrush Color="{StaticResource Application_Control_BorderBrush}"/>
            	</Border.BorderBrush>
            	<Border.Background>
            		<SolidColorBrush Color="{StaticResource Application_Control_Background}"/>
            	</Border.Background>
            </Border>
            <ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Border x:Name="FocusBorder" BorderThickness="1" CornerRadius="2" Opacity="1" Visibility="Hidden">
            	<Border.BorderBrush>
            		<SolidColorBrush Color="{StaticResource Application_Control_BorderBrush_Focus}"/>
            	</Border.BorderBrush>
            </Border>
            <Border x:Name="DefalutBorder" BorderThickness="2" Margin="0" Visibility="Hidden" CornerRadius="2">
            	<Border.BorderBrush>
            		<SolidColorBrush Color="{StaticResource Application_Control_BorderBrush_Default}"/>
            	</Border.BorderBrush>
            </Border>
		</Grid>
    	<ControlTemplate.Triggers>
    		<Trigger Property="IsEnabled" Value="False">
    			<Setter Property="Background" TargetName="ButtonBorder">
    				<Setter.Value>
    					<SolidColorBrush Color="{StaticResource Application_Control_Background_Disabled}"/>
    				</Setter.Value>
    			</Setter>
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Control_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
    		<Trigger Property="IsMouseOver" Value="True">
    			<Trigger.ExitActions>
    				<BeginStoryboard x:Name="MouseOut_BeginStoryboard" Storyboard="{StaticResource MouseOut}"/>
    				<StopStoryboard BeginStoryboardName="MouseIn_BeginStoryboard"/>
    				<StopStoryboard BeginStoryboardName="PressedOut_BeginStoryboard"/>
    			</Trigger.ExitActions>
    			<Trigger.EnterActions>
    				<BeginStoryboard x:Name="MouseIn_BeginStoryboard" Storyboard="{StaticResource MouseIn}"/>
    			</Trigger.EnterActions>
    		</Trigger>
    		<Trigger Property="IsPressed" Value="True">
    			<Trigger.ExitActions>
    				<BeginStoryboard x:Name="PressedOut_BeginStoryboard" Storyboard="{StaticResource PressedOut}"/>
    			</Trigger.ExitActions>
    			<Trigger.EnterActions>
    				<BeginStoryboard x:Name="PressedIn_BeginStoryboard" Storyboard="{StaticResource PressedIn}"/>
    			</Trigger.EnterActions>
    		</Trigger>
    		<Trigger Property="IsFocused" Value="True">
    			<Setter Property="Visibility" TargetName="FocusBorder" Value="Visible"/>
    		</Trigger>
    		<Trigger Property="IsDefault" Value="True">
    			<Setter Property="Visibility" TargetName="DefalutBorder" Value="Visible"/>
    		</Trigger>
    	</ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>